import java.util.concurrent.Callable;

class Counter{
    int count = 0;
    static int a = 0;
    synchronized public void addCount(){
        count++;
    }
    public void addCount2(){
        synchronized (this){
            count++;
        }
    }
    synchronized public static void increase(){
        a++;
    }
    public static void increase2(){
        synchronized (Counter.class){
            a++;
        }
    }
}
public class Demo {
    public static void main(String[] args) throws InterruptedException {
        Counter c = new Counter();
         Thread t1 = new Thread(() -> {
             for (int i = 0; i < 10000; i++) {
                 c.addCount2();
             }
         });
         Thread t2 = new Thread(() -> {
             for (int i = 0; i < 10000; i++) {
                 c.addCount2();
             }
         });
         t1.start();
         t2.start();
         t1.join();
         t2.join();
        System.out.println(c.count);
    }
}
